<#import "/macro.ftl" as m>
<@m.page_header  />
<script type="text/javascript" src="/assets/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/assets/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="/assets/ueditor/lang/zh-cn/zh-cn.js"></script>

<link rel="stylesheet" href="/assets/codemirror/4.2/lib/codemirror.css">
<#-- 编辑器样式 -->
<link rel="stylesheet" href="/assets/codemirror/4.2/theme/eclipse.css">
<link rel="stylesheet" href="/assets/codemirror/4.2/theme/the-matrix.css">
<link rel="stylesheet" href="/assets/codemirror/4.2/theme/neat.css">
<link rel="stylesheet" href="/assets/codemirror/4.2/theme/monokai.css">
<#-- 提示插件样式 -->
<link rel="stylesheet" href="/assets/codemirror/4.2/addon/hint/show-hint.css">
<#-- 查找插件 -->
<link rel="stylesheet" href="/assets/codemirror/4.2/addon/dialog/dialog.css">
<#-- F11全屏模式 -->
<link rel="stylesheet" href="/assets/codemirror/4.2/addon/display/fullscreen.css">
<link rel="stylesheet" href="/assets/codemirror/4.2/theme/night.css">
<#-- fold启动折叠模式 -->
<link rel="stylesheet" href="/assets/codemirror/4.2/addon/fold/foldgutter.css" />

<#-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<script src="/assets/codemirror/4.2/lib/codemirror.js"></script>
<#-- 自动提示编辑插件 -->
<script src="/assets/codemirror/4.2/addon/hint/show-hint.js"></script>
<script src="/assets/codemirror/4.2/addon/hint/xml-hint.js"></script>
<#-- 插件公用 -->
<script src="/assets/codemirror/4.2/mode/xml/xml.js"></script>
<script src="/assets/codemirror/4.2/mode/javascript/javascript.js"></script>
<script src="/assets/codemirror/4.2/mode/css/css.js"></script>
<script src="/assets/codemirror/4.2/mode/htmlmixed/htmlmixed.js"></script>
<script src="/assets/codemirror/4.2/mode/markdown/markdown.js"></script>
<#-- 编辑器样式 -->
<script src="/assets/codemirror/4.2/addon/selection/active-line.js"></script>
<script src="/assets/codemirror/4.2/addon/edit/matchbrackets.js"></script>
<#-- 查找插件 -->
<script src="/assets/codemirror/4.2/addon/dialog/dialog.js"></script>
<script src="/assets/codemirror/4.2/addon/search/searchcursor.js"></script>
<script src="/assets/codemirror/4.2/addon/search/search.js"></script>
<#-- 显示高亮预览 -->
<script src="/assets/codemirror/4.2/addon/runmode/runmode.js"></script>
<#-- 自动补齐</..>	 -->
<script src="/assets/codemirror/4.2/addon/edit/closetag.js"></script>
<script src="/assets/codemirror/4.2/addon/fold/xml-fold.js"></script>
<#-- F11全屏模式 -->
<script src="/assets/codemirror/4.2/addon/display/fullscreen.js"></script>
<#-- fold折叠 -->
<script src="/assets/codemirror/4.2/addon/fold/foldcode.js"></script>
<script src="/assets/codemirror/4.2/addon/fold/foldgutter.js"></script>
<script src="/assets/codemirror/4.2/addon/fold/brace-fold.js"></script>
<script src="/assets/codemirror/4.2/addon/fold/xml-fold.js"></script>
<script src="/assets/codemirror/4.2/addon/fold/markdown-fold.js"></script>
<script src="/assets/codemirror/4.2/addon/fold/comment-fold.js"></script>
<script>
	var IMG_PATH = '${image_base}'
</script>

<div id="page-content-wrapper">

<div id="page-title">

    <h3>
        <#if pageTemplate>修改页面模版<#else>添加页面模版</#if>
    </h3>
</div>
<div class="pad10A">
<form id="demo-form1" action="/page/template/<#if pageTemplate>update<#else>add</#if>" class="col-md-12" method="POST">
	<#if pageTemplate>
	<input type="hidden" name="id" value="${pageTemplate.id}"/>
	</#if>
    <div class="form-row">
        <div class="form-label col-md-2">
            <label for="">
                标题:
                <span class="required">*</span>
            </label>
        </div>
        <div class="form-input col-md-3">
            <input type="text" id="title" name="title"  data-trigger="change" data-required="true" class="parsley-validated" value="${((pageTemplate.title)!'')?xhtml}">
        </div>
    </div>
    <div class="form-row">
        <div class="form-label col-md-2">
            <label for="">
                内容:
                <span class="required">*</span>
            </label>
        </div>
        <div class="form-input col-md-3">
            <form>
			 	<textarea id="uecontent" name="content" placeholder="请输入页面模板" style="width:600px;height:400px;">
					${(pageTemplate.content)!}
				</textarea>
			 </form>
        </div>
    </div>
    <div class="divider"></div>
    <div class="form-row">
        <input type="hidden" name="superhidden" id="superhidden">
       <div class="form-input col-md-10 col-md-offset-2">
                    <a href="javascript:;" class="btn medium primary-bg radius-all-4 col-md-2" id="demo-form-2-valid">
                        
                                                                         提交
                        
                 </a>
        </div>
    </div>   

</form>
</div>
</div>
<script type="text/javascript" src="/assets/js/pager_template_codemirror.js"></script><!-- 实例化编辑器 -->
<script type="text/javascript">
<#if pageTemplate!=null>
var uySaveFloder ="template/${pageTemplate.id}";
</#if>
<#if pageTemplate==null>
var uySaveFloder ="template/"+new Date().getFullYear()+""+new Date().getMonth()+""+new Date().getDate();
</#if>
	var c = UE.getEditor('uecontent',{upYunSaveFolder:uySaveFloder});
          
    c.options.allowDivTransToP=false;
	$(function(){
	    $("#demo-form-2-valid").click(function(){
	    	$('#demo-form1').parsley('validate');
	    	$('#demo-form1').trigger('submit');
	});
    
})
</script>
<@m.page_footer />